import request from '@/utils/request'
import { remoteRequest } from '@/utils/remote.js'

// 获取模型详情（taskId，dtmId，modelType）
export function getTaskModelDetail(params) {
  let url = params.dtmId ? '/eqLandslide/getTaskModelDetailMil' : '/eqLandslide/getTaskModelDetail'
  return request({
    url,
    method: 'get',
    params
  })
}

// 查看任务
export function detailTask(query) {
  return request({
    url: '/preAssessTask/findById',
    method: 'get',
    params: query
  })
}

// 获取中间结果
export function getDzzhTaskModel(query) {
  return request({
    url: '/eqLandslide/getDzzhTaskModel',
    method: 'get',
    params: query
  })
}

// 存为中间结果
export function saveAsMiddleResult(data) {
  return request({
    url: '/eqLandslide/updateDzzhTaskModel1',
    method: 'post',
    data: data
  })
}

// 替换为最终结果
export function replaceFinalResult(data) {
  return request({
    url: '/eqLandslide/updateDzzhTaskModel2',
    method: 'post',
    data: data
  })
}

// 删除
export function delDzzhTaskModel(data) {
  return request({
    url: '/eqLandslide/delDzzhTaskModel',
    method: 'post',
    data: data
  })
}

// 评估计算
export function count1(data) {
  return remoteRequest('count1', data, () => {
    return request({
      url: '/eqLandslide/count1',
      method: 'post',
      data,
      headers: {
        repeatSubmit: false
      }
    })
  })
}
// 评估计算
export function getDataByTaskId1(query) {
  return request({
    url: '/eqLandslide/getDataByTaskId1',
    method: 'get',
    params: query
  })
}
// 获取坡度数据版本
export function getSlopeData(query) {
  return request({
    url: '/sysDataVersion/getYwVesrionData',
    method: 'get',
    params: query
  })
}

export function getParam1Version(data) {
  return request({
    url: '/lawAnalysis/getParam1Version',
    method: 'post',
    data: data
  })
}
// 
export function saveTaskModel(data) {
  return request({
    url: '/eqLandslide/saveTaskModel',
    method: 'post',
    data: data
  })
}
// 获取工程地质岩组归并
export function getLithology(query) {
  return request({
    url: '/eqLandslide/queryDataByVersionCode',
    method: 'get',
    params: query
  })
}

// 导入地层岩性数据
export function getParseShp(query) {
  return request({
    url: '/eqLandslide/parseShp',
    method: 'get',
    params: query
  })
}

// 获取导入地层岩性数据
export function getAttachByIds(query) {
  return request({
    url: '/attachment/getAttachByIds',
    method: 'get',
    params: query
  })
}